//
//  TextFieldAlertView.m
//  Rail
//
//  Created by huyuchen on 2018/3/21.
//  Copyright © 2018年 Hychen. All rights reserved.
//

#import "TextFieldAlertView.h"

@interface TextFieldAlertView ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UITextField *textfield;
@property (weak, nonatomic) IBOutlet UIButton *submitButton;
@end
@implementation TextFieldAlertView

+ (instancetype)alertView {
    TextFieldAlertView *view = [[[NSBundle mainBundle] loadNibNamed:@"TextFieldAlertView" owner:nil options:nil] lastObject];
    view.frame = CGRectMake(0, 0, ResizeW(280), 185);
    return view;
}

- (void)didMoveToSuperview {
    [self.textfield becomeFirstResponder];
}

- (IBAction)clickSubmitButton:(UIButton *)sender {
    if (self.BlockClickSubmit) {
        self.BlockClickSubmit(self.textfield.text.copy);
    }
}

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}

@end
